package com.city.service.party.impl;

import com.city.domain.party.PartyStudent;
import com.city.repository.party.PartyStudentRepository;
import com.city.service.party.PartyStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PartyStudentServiceImpl implements PartyStudentService{


    @Autowired
    private PartyStudentRepository partyStudentRepository;
    @Override
    public void save(PartyStudent partyStudent) {
        partyStudentRepository.save(partyStudent);
    }

    @Override
    public PartyStudent fingByTime(String time) {
        return partyStudentRepository.findByTime(time);
    }

    @Override
    public List<PartyStudent> findByPage(Integer page, Integer limit) {
        return partyStudentRepository.findByPage((page-1)*limit,limit);
    }

    @Override
    public PartyStudent findById(int id) {
        return partyStudentRepository.findOne(id);
    }

    @Override
    public long count() {
        return partyStudentRepository.count();
    }

    @Override
    public void delete(int id) {
        partyStudentRepository.delete(id);
    }


}
